home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / cbibcode.arc / UNIX2DOS.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-05  |  512 b   |  18 lines

  1. /* UNIX2DOS.C --- p. 675 */
  2. #include <dos.h>
  3. #include <time.h>
  4. void main()
  5. {
  6.     struct date date;
  7.     struct time timep;
  8.     time_t tunix;
  9.                 /* Get date and time in UNIX format */
  10.     time(&tunix);
  11.                 /* Convert to DOS style date and time */
  12.     unixtodos((long)tunix, &date, &timep);
  13.                 /* Print date and time */
  14.     printf("Current date: %d-%d-%d\n", date.da_mon, date.da_day,
  15.                              date.da_year);
  16.     printf("Current time: %d:%d:%d:%d\n", timep.ti_hour, timep.ti_min,
  17.                      timep.ti_sec, timep.ti_hund);
  18. }